#include "Arduino.h"
#include "SwitchRailDriverData.h"

/* CONSTRUCTOR */
SwitchRailDriverData::SwitchRailDriverData(byte id, int coilPortGoStraightOn, int coilPortChangeDirection)
{
  m_id = id;
  if(coilPortGoStraightOn < SwitchRailDriverData::minSwitchPort || coilPortGoStraightOn > SwitchRailDriverData::maxSwitchPort) {
    m_coilPortGoStraightOn = 0U;
  }
  else
  {
    m_coilPortGoStraightOn = coilPortGoStraightOn;
  }
  if(coilPortChangeDirection < SwitchRailDriverData::minSwitchPort || coilPortChangeDirection > SwitchRailDriverData::maxSwitchPort) {
    m_coilPortChangeDirection = 0U;
  }
  else
  {
    m_coilPortChangeDirection = coilPortChangeDirection;
  }
}


/* METHODES */

/**
* \brief Get Switch rail driver data Id
* \param none
* \return Id
*/ 
byte SwitchRailDriverData::getId() {
  return m_id;
}

/**
* \brief Get Switch rail driver data Port
* \param none
* \return switchPort
*/ 
int SwitchRailDriverData::getCoilPortGoStraightOn() {
  return m_coilPortGoStraightOn;
}

/**
* \brief Get Switch rail driver data Port
* \param none
* \return switchPort
*/ 
int SwitchRailDriverData::getCoilPortChangeDirection() {
  return m_coilPortChangeDirection;
}


